<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:sec="http://www.springframework.org/security/tags">

	<div id="menuContainer" class="ui-menu-container">
		<p:menu id="menuComponent" type="sliding" 
			styleClass="ui-white-menu ui-corner-all">

			<p:submenu label="Modulo Empleados" icon="ui-icon ui-icon-refresh">
				<p:menuitem value="Lista de Empleados" immediate="true"
					global="false" action="list_employees?faces-redirect=true"
					icon="ui-icon ui-icon-disk" />
				<sec:authorize ifAllGranted="ROLE_ADMIN">

					<p:menuitem value="Agregar Empleado" global="false"
						actionListener="#{tasksTableBean.cleanVariables}"
						action="new_employee?faces-redirect=true" immediate="true"
						icon="ui-icon ui-icon-arrowrefresh-1-w">
						<f:setPropertyActionListener
							target="#{tableBean.selectedEmployee}"
							value="#{tasksTableBean.selectedEmployee}" />
					</p:menuitem>
					<p:menuitem value="Editar Empleado" global="false"
						action="edit_employee?faces-redirect=true" immediate="true"
						icon="ui-icon ui-icon-arrowrefresh-1-w">
						<f:setPropertyActionListener
							target="#{tableBean.selectedEmployee}"
							value="#{tasksTableBean.selectedEmployee}" />
					</p:menuitem>
				</sec:authorize>
			</p:submenu>
			<sec:authorize ifAllGranted="ROLE_ADMIN">
				<p:submenu label="Modulo Actividades" icon="ui-icon ui-icon-refresh">
					<p:menuitem value="Agregar una Actividad" global="false"
						actionListener="#{tasksTableBean.newActivity}"
						action="new_activity?faces-redirect=true" immediate="true"
						process="@this" icon="ui-icon ui-icon-arrowrefresh-1-w" />
					<p:menuitem value="Editar actividad" global="false"
						actionListener="#{tasksTableBean.beforeEditActivity}"
						action="edit_activity?faces-redirect=true" immediate="true"
						process="@this" icon="ui-icon ui-icon-arrowrefresh-1-w">
						<f:setPropertyActionListener
							target="#{tasksTableBean.selectedActivity.employeeCreator}"
							value="#{tasksTableBean.selectedEmployee}" />
					</p:menuitem>
				</p:submenu>
				<p:submenu label="Modulo Administrador" icon="ui-icon ui-icon-refresh">
					<p:menuitem value="Administrar Tareas" global="false"
						action="employee_tasks?faces-redirect=true" immediate="true"
						process="@this" icon="ui-icon ui-icon-arrowrefresh-1-w" />
				</p:submenu>

			</sec:authorize>
			<p:submenu label="Dashboard" icon="ui-icon ui-icon-refresh">
				<p:menuitem value="Dashboard" immediate="true" global="false"
					action="dashboard?faces-redirect=true"
					actionListener="#{tasksTableBean.onEnter}"
					icon="ui-icon ui-icon-disk" />
			</p:submenu>
			<p:submenu label="Logout" action="logout"
				icon="ui-icon ui-icon-refresh">
				<p:menuitem value="Salir"
					url="#{request.contextPath}/j_spring_security_logout"
					immediate="true" />
			</p:submenu>
		</p:menu>
	</div>
</ui:composition>





